
import numpy as np

# 创建一个线段型数组
arr = np.linspace(1, 10, 20)

# 将一维数组改变为2×10的矩阵
matrix = arr.reshape(2, 10)
print(matrix)
# 计算每行所有元素的和
row_sums = matrix.sum(axis=1)

print(row_sums)
